package com.iflytek.springboot_medicine.mapper;


import com.iflytek.springboot_medicine.entity.Operation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OperationMapper {
    @Select("SELECT id, user_id, username, user_role, class_name, method_name, request_url, " +
            "request_params, execution_time, status, error_message, ip_address, create_time, operation_type " +
            "FROM controller_method_log")
    void selectOperation();

    @Select("SELECT id, user_id, username, user_role, class_name, method_name, request_url, " +
            "request_params, execution_time, status, error_message, ip_address, create_time, operation_type " +
            "FROM controller_method_log " +
            "ORDER BY id DESC " +
            "LIMIT #{skipNum}, #{pageSize}")
    List<Operation> selectBypage(
            @Param("skipNum") Integer skipNum,
            @Param("pageSize") Integer pageSize
    );

    @Select("SELECT COUNT(id) FROM controller_method_log ")
    Integer selectCountByPage();
}
